<template>
  <div>
    <BasicTable @register="registerTable">
      <template #action="{ record }"> </template>
    </BasicTable>
  </div>
</template>
<script lang="ts" setup name="tempUserGoodsPage">
import { BasicTable } from '@apps/antd-admin/src/components/table';
import { useBaseTable } from '@apps/antd-admin/src/hooks';
import { Api } from './api';

import { useDrawer } from '@apps/antd-admin/src/components/drawer';
import { columns, searchFormSchema } from './data';

const [registerDrawer, { openDrawer }] = useDrawer();

const { prefixCls, tableContext, handleDelete, handleSuccess, handlePost, handleBatchDelete } = useBaseTable({
  designScope: 'tempUserGoodsPage-template',
  tableProps: {
    //表格标题
    title: '用户商品信息',
    //主键字段
    rowKey: 'userGoodsId',
    //列表接口
    listUrl: Api.page,
    //列定义
    columns,
    //查询表单配置
    formConfig: {
      labelWidth: 120,
      schemas: searchFormSchema,
    },
    showActionColumn: false,
    clickToRowSelect: true,
    rowSelection: {
      type: 'radio',
    },
  },
});
const [registerTable, { getForm, setProps, reload }, { rowSelection, hasSelectedRows, selectedRow }] = tableContext;
function handleCreate() {
  openDrawer(true, {
    isUpdate: false,
  });
}

function handleEdit(record: Recordable) {
  openDrawer(true, {
    record,
    isUpdate: true,
  });
}
</script>
